<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html 	xmlns="http://www.w3.org/1999/xhtml" 
		xmlns:ui="http://java.sun.com/jsf/facelets" 
		xmlns:h="http://java.sun.com/jsf/html"
		xmlns:f="http://java.sun.com/jsf/core" 
		xmlns:p="http://primefaces.org/ui" 
		xmlns:pe="http://primefaces.org/ui/extensions" >
<h:body>
	<p:dialog widgetVar="memberPackageExpiryDialogWidget"
			id="memberPackageExpiryDialogWidgetId" height="550" width="500" header="Membership Package/Membership Expiry"
			closable="true" draggable="true" resizable="false" modal="true" appendToBody="true">
			<h:form id="PackageExpiryMemberForm" >
			<p:messages id="messages" showDetail="true" autoUpdate="true" closable="true" />  
			<p:panel id="panel" header="Change Membership Package/Change Expiry Membership">  
				
					<h:panelGrid columns="3">  
					    <h:outputLabel for="name" value="Name: *" />  
					    <p:inputText id="name" value="#{memberMB.member.name}" required="true" label="Name" maxlength="100" readonly="true">
					    </p:inputText>
					    <p:message id="nameMsg" for="name" display="default" />  					
						<h:outputText for="Membership" value="Membership Package: *" />  
				        <p:selectOneMenu value="#{memberMB.member.membership.id}" effect="fade"  required="true" label="Membership" id="Membership" converter="omnifaces.SelectItemsConverter">  
				            <f:selectItem itemLabel="Select One" itemValue="" />  
				            <f:selectItems value="#{membershipMB.activeMemberships}" var="membership" itemLabel="#{membership.name}" itemValue="#{membership.id}"/>
				            <f:ajax render="MembershipInfo"/>  
				        </p:selectOneMenu> 	
				        <p:message id="MembershipMsg" for="Membership" display="default" />
					</h:panelGrid>
			        <h:panelGrid id="MembershipInfo" columns="2">
			        	<h:outputText style="font-weight:bold" value="Price (RM): " />
			        	<h:outputText value="#{memberMB.member.membership.price}" />
			        	
			        	<h:outputText style="font-weight:bold" value="Description: " />
			        	<h:outputText value="#{memberMB.member.membership.description}" />				        	
			        </h:panelGrid>	
			        
					<h:panelGrid columns="3">  			        
					    <h:outputLabel for="expiryDate" value="Membership Expiry: *" />  
					    <p:calendar id="expiryDate" value="#{memberMB.member.membershipExpiryDate}" navigator="true" display="inline" label="expiryDate" required="true">
					    </p:calendar>  
					    <p:message id="expiryDateMsg" for="expiryDate" display="default" />  			        				
					</h:panelGrid>
					
					<p:commandButton id="btnSave" value="Update" update=":memberList:memberTable" action="#{memberMB.packageExpiryMember}"
					oncomplete="closeDialogIfSucess(xhr, status, args, memberPackageExpiryDialogWidget 'memberSuspendTerminateDialogWidgetId')" />  
				
			</p:panel>
			</h:form>
		</p:dialog>	
</h:body>
</html>